from configparser import ConfigParser
# config = ConfigParser()
# config.read("config.ini")
# 查看某个选项  (option)
"""VALUE = config.get('URL','dev_base_url')
print(VALUE)
print(type(VALUE))"""
#  修改ini文件
"""
config.set('URL','dev_base_url','www.lixin.com')
with open('config.ini','w') as f:
    config.write(f)
"""
# 查看下修改是否成功
"""
value = config.get("URL","dev_base_url")
print(value)
"""
# 删除一个节
"""
config.remove_section('tester')
with open('config.ini','w') as f:
    config.write(f)
"""
# 删除一个选项
"""
config.remove_option("URL",'test_base_url')
with open('config.ini','w') as f:
    config.write(f)
"""
# 查看所有的节
print(config.sections())

# 查看某个选项是否存在于节
print(config.has_option('URL', 'dev_base_url')) # 真、假


